import java.util.Scanner;

/**
 * 完全数
 */
public class HJ56 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int num = scanner.nextInt();
            if(num < 6) {
                System.out.println(0);
                break;
            }
            int count = 0;
            for (int i = 6; i <= num; i++) {
                int res = 0;
                for(int j = 1; j <= i/2; j++){
                    if(i%j == 0){
                        res+=j;
                    }
                }
                if(res == i){
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
